package com.gigmissions.server.services;

import java.util.ArrayList;
import java.util.List;

import com.gigmissions.client.config.GigMissionsImageTypes;
import com.gigmissions.client.dto.Artist;
import com.gigmissions.client.dto.Event;
import com.gigmissions.client.dto.EventDetails;
import com.gigmissions.client.dto.EventRewardDetails;
import com.gigmissions.client.dto.EventTimeDetails;
import com.gigmissions.client.dto.EventType;
import com.gigmissions.client.dto.FacebookLink;
import com.gigmissions.client.dto.Link;
import com.gigmissions.client.dto.MySpaceLink;
import com.gigmissions.client.dto.Venue;
import com.gigmissions.client.dto.YouTubeLink;
import com.gigmissions.client.services.ArtistService;
import com.gigmissions.server.repository.Repository;
import com.google.inject.Inject;

public class ArtistServiceImpl implements ArtistService {

  @Inject
  private Repository repository;
  
	/**
	 * 
	 */
	private static final long serialVersionUID = -2683701938226018646L;
	
	public ArtistServiceImpl(){
	  
	  	  
	};

	@Override
	public List<Artist> getArtists(int startIndex, int endIndex) {
		List<Artist> artists = new ArrayList<Artist>();
		
		String test = "repository is null";
		if(repository!=null)
		test = "repository open!";
		
		List<Link> links = new ArrayList<Link>();
		
		links.add(new FacebookLink("http://facebook1"));
		links.add(new MySpaceLink("http://myspace1"));
		links.add(new YouTubeLink("http://youtube1"));
		
		
		
		Artist a = new Artist("123456","translate" +  test,links,213434,GigMissionsImageTypes.BAND_ICON,getEvents());
		artists.add(a);

		links = new ArrayList<Link>();
    
    links.add(new FacebookLink("http://facebook2"));
    links.add(new MySpaceLink("http://myspace2"));
    links.add(new YouTubeLink("http://youtube2"));

		
		Artist b = new Artist("123455","the sicks",links,12345,GigMissionsImageTypes.BAND_ICON,getEvents());
		artists.add(b);
		
		return artists;
	}

  public List<Event> getEvents(){
	  
	    List<Event> events = new ArrayList<Event>();
		
		EventTimeDetails time = new EventTimeDetails();
		time.setEndDate("22/3/2010");
		time.setStartDate("22/3/2010");
		time.setStartTime("8:00pm");
		time.setEndTime("12:00pm");
		
		EventRewardDetails reward = new EventRewardDetails();
		reward.setPoints(5);
		reward.setReward("5 points for anyone that signs this bands mailing list.");

		EventDetails details = new EventDetails();
		details.setDescription("Sick gigi its the gratest");
		details.setEventRewardDetails(reward);
		details.setEventTimeDetails(time);
	    
		Venue venue = new Venue();
	    venue.setLat("-37.45");
	    venue.setLng("144.389");
	    venue.setName("Arthouse");
	    venue.setPhone("1" +System.currentTimeMillis());
	    venue.setGeocodeableAddress("5 Station Ave Emerald, Vic");
	    
		Event e = new Event();
		e.setVenue(venue);
		e.setName("Title");
		events.add(e);
		
		return events;
  }
	
  @Override
  public Artist putArtist(Artist artist) {
    
    artist.setId("testid123");
    
    return artist;
    
  }
	
	
	
	
	

}
